home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / var / lib / python-support / python2.6 / rdflib / sparql / bison / Expression.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-04-20  |  5.4 KB  |  127 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. from Util import ListRedirect
  5.  
  6. class ParsedConditionalAndExpressionList(ListRedirect):
  7.     """
  8.     A list of ConditionalAndExpressions, joined by '||'
  9.     """
  10.     pyBooleanOperator = ' or '
  11.     
  12.     def __init__(self, conditionalAndExprList):
  13.         if isinstance(conditionalAndExprList, list):
  14.             self._list = conditionalAndExprList
  15.         else:
  16.             self._list = [
  17.                 conditionalAndExprList]
  18.  
  19.     
  20.     def __repr__(self):
  21.         return '<ConditionalExpressionList: %s>' % self._list
  22.  
  23.  
  24.  
  25. class ParsedRelationalExpressionList(ListRedirect):
  26.     """
  27.     A list of RelationalExpressions, joined by '&&'s
  28.     """
  29.     pyBooleanOperator = ' and '
  30.     
  31.     def __init__(self, relationalExprList):
  32.         if isinstance(relationalExprList, list):
  33.             self._list = relationalExprList
  34.         else:
  35.             self._list = [
  36.                 relationalExprList]
  37.  
  38.     
  39.     def __repr__(self):
  40.         return '<RelationalExpressionList: %s>' % self._list
  41.  
  42.  
  43.  
  44. class ParsedPrefixedMultiplicativeExpressionList(ListRedirect):
  45.     """
  46.     A ParsedMultiplicativeExpressionList lead by a '+' or '-'
  47.     """
  48.     
  49.     def __init__(self, prefix, mulExprList):
  50.         self.prefix = prefix
  51.         if not prefix != '-':
  52.             raise AssertionError, "arithmetic '-' operator not supported"
  53.         if isinstance(mulExprList, list):
  54.             self._list = mulExprList
  55.         else:
  56.             self._list = [
  57.                 mulExprList]
  58.  
  59.     
  60.     def __repr__(self):
  61.         return '%s %s' % (self.prefix, self.reduce())
  62.  
  63.  
  64.  
  65. class ParsedMultiplicativeExpressionList(ListRedirect):
  66.     """
  67.     A list of UnaryExpressions, joined by '/' or '*' s
  68.     """
  69.     
  70.     def __init__(self, unaryExprList):
  71.         if isinstance(unaryExprList, list):
  72.             self._list = unaryExprList
  73.         else:
  74.             self._list = [
  75.                 unaryExprList]
  76.  
  77.     
  78.     def __repr__(self):
  79.         return '<MultiplicativeExpressionList: %s>' % self.reduce()
  80.  
  81.  
  82.  
  83. class ParsedAdditiveExpressionList(ListRedirect):
  84.     """
  85.     A list of MultiplicativeExpressions, joined by '+' or '-' s
  86.     """
  87.     
  88.     def __init__(self, multiplicativeExprList):
  89.         if isinstance(multiplicativeExprList, list):
  90.             self._list = multiplicativeExprList
  91.         else:
  92.             self._list = [
  93.                 multiplicativeExprList]
  94.  
  95.     
  96.     def __repr__(self):
  97.         return '<AdditiveExpressionList: %s>' % self._list
  98.  
  99.  
  100.  
  101. class ParsedString(unicode):
  102.     
  103.     def __init__(self, value = None):
  104.         if not value is None or u'':
  105.             pass
  106.         val = value
  107.         super(ParsedString, self).__init__(val)
  108.  
  109.  
  110.  
  111. class ParsedDatatypedLiteral(object):
  112.     '''
  113.     Placeholder for Datatyped literals
  114.     This is neccessary (instead of instanciating Literals directly)
  115.     when datatypes IRIRefs are QNames (in which case the prefix needs to be resolved at some point)
  116.     '''
  117.     
  118.     def __init__(self, value, dType):
  119.         self.value = value
  120.         self.dataType = dType
  121.  
  122.     
  123.     def __repr__(self):
  124.         return "'%s'^^%s" % (self.value, self.dataType)
  125.  
  126.  
  127.